<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>softMin</title>
<style type="text/css">
	body {background-color: white; color: black; font-family:sans-serif; font-size:medium;}
	a:link {color: #3300ff;}
	a:visited {color: #663399;}
	a:hover {color:#0099ff;}
	a:active {color: #0066cc;}
	a.button {text-decoration:none;}
	
	table.nav  {background-color: #dbddff;}
	table.body {margin-top:2ex; margin-bottom:2ex;}
	table.programlistingindent {margin-left:32px;}
	
	img { margin-bottom:0px; margin-top:0px;}
	tt {margin-left:0.5em; margin-right:0.5em; font-weight:lighter;}
	
	p {margin-top:0ex;}
	p.synopsis {margin-left:32px;}
	p.programlistingindent {margin-left:32px;}
	p.citetitle {margin-left:2em;}
	
	ul ul {list-style-type:square;}
	ul li p {margin-top:0ex; margin-bottom:.5ex; padding:0}
	ol li p {margin-top:0ex; margin-bottom:.5ex; padding:0}
	
	h1.reftitle {color:#a90000;}
	h1.reftitle {font-size:3.7ex; margin-top:0; margin-bottom:0; font-weight:bold}
	h1.title {color:black; font-size:4ex; margin-top:1ex; font-weight:bold}
	h2.title {color:#bd0000; margin-top:1ex; margin-bottom:.9ex; font-weight:bold; font-size:3ex}
	h3.title {color:#bd0000; margin-top:1ex; margin-bottom:.9ex; font-weight:bold; font-size:2.5ex}
	h4.title {color:#bd0000; margin-top:1ex; margin-bottom:.9ex; font-weight:bold; font-size:2ex}
	h2 {color:#bd0000; margin-top:1ex; margin-bottom:.9ex; font-weight:bold; font-size:2.5ex}
	h3 {color:#bd0000; margin-top:1ex; margin-bottom:.9ex; font-weight:bold; font-size:2ex} 
	
	pre.programlisting {margin-left:32px;}
	pre.synopsis {margin-left:32px;}
	
	
	.categorytitle {margin-top:8px; padding-top:0px;}
	.categorylist {background-color: #e1e6f2;}
 	</style>
</head>
<body>
<a name="top_of_page"></a><p style="font-size:1px;"></p>
<h1 class="reftitle">softMin</h1>
<h2>Purpose</h2>
<p>Soft lower bound constraint</p>
<h2>Syntax</h2>
<pre class="synopsis"></pre>
<h2>Description</h2>
<p></p> 
    This filter will soften the lower bound constraint on a selected
    signal in the MPC setup. Without this filter, lower bounds are
    hard, i.e., the signal has to satisfy <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin1.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin1.png">. With this filter added, the lower bound is soft and can
    be violated by some positive margin <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin2.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin2.png">, i.e., the new
    constraint becomes <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin3.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin3.png">. The slack
    variables <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin4.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin4.png"> are then penalized in the MPC cost function
    by adding the term <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin5.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin5.png">.<br><br>

    To enable this filter, first call
    <tt>model.signal.with('softMin')</tt>, where you replace
    <tt>signal</tt> by the actual system's signal (typically by
    <tt>x</tt> for state variables, <tt>u</tt> for inputs, and
    <tt>y</tt> for outputs).<br><br>

    With the filter enabled, you can set the maximal allowed
    violation of the constraint in
    <tt>model.signal.softMin.maximalViolation</tt>, and specify
    penalization of the slack variables by setting
    <tt>model.signal.softMin.penalty</tt>.<br><br>

    To remove this filter, call
    <tt>model.signal.without('softMin')</tt>.
  <h2>Example(s)</h2>
<h3>Example 
				1</h3>Specify an LTI system <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin6.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin6.png">, <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin7.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin7.png">
      <pre class="programlisting">sys = LTISystem('A', 0.9, 'B', 1, 'C', 1);</pre>
<pre class="programlisting"></pre>Add unity quadratic penalties on states and inputs (but not
    on the terminal state)<pre class="programlisting">
		sys.x.penalty = QuadFunction(1);
		sys.u.penalty = QuadFunction(1);
	</pre>
<pre class="programlisting"></pre>Define hard state constraints<pre class="programlisting">sys.x.min = -1; sys.x.max = 1;</pre>
<pre class="programlisting"></pre>Make the lower bound soft with maximal violation of <img src="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin8.png" alt="../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmin8.png">
      <pre class="programlisting">
		sys.x.with('softMin');
		sys.x.softMin.maximalViolation = 3;
		M = MPCController(sys, 4);
		x0 = -3.5;
		[u, feasible, openloop] = M.evaluate(x0)
	</pre>
<pre class="programlisting">
u =

                      2.15


feasible =

     1


openloop = 

    cost: 25018.3457016632
       U: [2.15 0.525779625779547 0.168399168399664 7.04103442217274e-13]
       X: [-3.5 -0.999999999999999 -0.374220374220451 -0.168399168398741 -0.151559251558165]
       Y: [-3.5 -1 -0.37422037422045 -0.168399168398741]

</pre>
<p></p>
<table class="nav" summary="Navigation aid" border="0" width="100%" cellpadding="0" cellspacing="0"><tr valign="top">
<td align="left" width="20">
<a href="filter_block.html" class="button">&#9664;</a>  </td>
<td align="left">filter_block</td>
<td>  </td>
<td align="right">filter_setconstraint</td>
<td align="right" width="20"><a href="filter_setconstraint.html" class="button">&#9654;</a></td>
</tr></table>
<br><p>©  <b>2003-2013</b>     Michal Kvasnica: STU Bratislava,    <a href="mailto:michal.kvasnica@stuba.sk">michal.kvasnica@stuba.sk</a></p>
</body>
</html>
